package com.my12306.train.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 柱状图表信息
 *
 * @author mifen
 * @email
 * @date 2020-08-24 20:58:07
 */
@AllArgsConstructor
@Data
@NoArgsConstructor
public class ChartBarVo implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 月份信息
     */
    private String name;
    /**
     * 显示类型
     */
    private String type;
    /**
     * 显示归类
     */
    private String stack;
    /**
     * 每月售票额数组
     */
    private Double[] data;

    /**
     * 对于空的实现初始化
     *
     * @return
     */
    public ChartBarVo init(String type) {
        if (this.getData() == null) {
            Double[] list = new Double[5];
            for (int i = 0; i < 5; i++) {
                list[i]=0.0;
            }
            this.setData(list);
            this.setType(type);
            this.setStack("total");
        }
        return this;
    }
}
